home *** CD-ROM | disk | FTP | other *** search
- Path: anise.age.uiuc.edu!isa5224
- From: isa5224@age2.age.uiuc.edu (Irfan S. Ahmad)
- Newsgroups: comp.lang.c
- Subject: Int to Double, Pl Advise!
- Date: Fri, 29 Mar 1996 04:18:02 GMT
- Organization: Univeristy of Illinois
- Message-ID: <isa5224.544.315B647A@age2.age.uiuc.edu>
- NNTP-Posting-Host: anise.age.uiuc.edu
- X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #1]
-
- Hi:
-
- I am having problems with the following type conversion. From int to double.
- If someone can comment:
-
- #define Ng 4
- #define Nr 4
-
- #include <stdio.h>
- #include <math.h>
- #include <malloc.h>
-
- int p0[Ng][Nr];
-
- int main(){
- int i,j,k;
- float x =0;
- float y =0;
- :
- :
- :
- for (i=1; i<Ng; i++) {
- for (j=1; j<Nr; j++) {
-
- x = x + ((double) p0[i,j]) / (double)(j*j); }
- }
-
- I get the following compilation error(s) on MS C++ compiler:
- error C2440: 'cast' : cannot convert from 'int [4]' to 'double '
-
-
- Please post or preferably email your comments to:
- isa5224@sugar.age.uiuc.edu
-
- Thanks.
-
- Irfan
-